Repository navigation
[eas-cli] Write the reason a command failed to stderr - #4592
Conversation
d0c7d9e to
0559704
Compare
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## vonovak/dependency-notice-tty #4592 +/- ##
=================================================================
- Coverage 75.59% 75.58% -0.00%
=================================================================
Files 1054 1054
Lines 52437 52440 +3
Branches 11459 11459
=================================================================
Hits 39634 39634
- Misses 11822 11825 +3
Partials 981 981 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
0559704 to
3cb54f7
Compare
|
Subscribed to pull request
Generated by CodeMention Warning: The preamble and epilogue options in commentConfiguration are deprecated. Use template instead. |
|
eas-cli now uses changesets for changelogs (#4580). The required "Check for a changeset" check fails on PRs that edit To update this PR:
The release adds the PR link and the author to the entry. If this PR needs no changelog entry, revert the |
3cb54f7 to
e9ab32e
Compare
douglowder
left a comment
There was a problem hiding this comment.
The change looks good to me: it moves only the failure reason in EasCommand.catch, so a successful run writes nothing new to stderr. A few small notes:
- Description: The "How" section says
Log.errorinenv:deleteexits 0, butenv:deletethrows right after it (Variable "…" not deleted.).env:getis a correct example; the keystore fallback incredentials/android/utils/keystore.ts(Failed to generate keystore locally. Falling back to cloud generation.) is another. - Color in redirected stderr:
errorToStderruses the defaultchalkinstance, which takes its color level from stdout, soeas … 2>err.login a terminal writes color codes to the file. Achalkinstance with its level from stderr would fix it. Fine to leave as the noted known limit if you prefer to keep this PR small. - Tests: The updated tests check that
Log.errorToStderris called, not that the output reaches stderr. Acceptable for a one-line function, since the livebuild:listrun in the test plan covers the stream.
EasCommand.catch printed the reason with Log.error, which writes to stdout. oclif then printed "<command> command failed." to stderr. A program that reads stderr for the error found only that generic line. Only the catch changes. Other Log.error and Log.warn calls stay on stdout, because some of them are not failures and the spinner keeps non-TTY output off stderr on purpose. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
e3c1933 to
94fe3c4
Compare
chalk's default instance takes its color level from stdout, so `eas ... 2>err.log` in a terminal wrote color codes to the file. Also spy on errorToStderr in the already-printed catch test. The catch no longer calls Log.error, so the test passed even without the messageAlreadyPrinted guard. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
4a9e606 to
0a85cda
Compare
@douglowder I updated the description, and fixed the color in redirected stderr: 0a85cda |
|
✅ Thank you for adding a changeset! |
Why
When a command fails,
EasCommand.catchprints the (helpful) reason withLog.error, which writes to stdout. Then oclif prints<command> command failed.to stderr. A program that reads stderr for the error finds only the generic (not helpful) line.Stacked on #4591. This is the second of four PRs: #4591 ← #4592 (this PR) ← #4593 ← #4594.
How
Add
Log.errorToStderrand use it inEasCommand.catchonly. OtherLog.errorandLog.warncalls stay on stdout:Log.errorcalls are not failures and exit 0, for example inenv:getand in the Android keystore fallback to cloud generation.ora.tskeeps non-TTY output on stdout on purpose, because some CI systems treat stderr as a failure. A failing command already writes to stderr through oclif, so this PR adds no new stderr output to a run that succeeds.With
--json, nothing changes: stdout was already redirected to stderr.Trade-off: a program that reads stderr for errors now finds the reason there, and a program that parses stdout no longer gets the reason mixed into it. A program that reads the reason from stdout must read stderr instead, so the changelog lists this under breaking changes. The callers in this repo that run eas-cli (build-tools and eas-build-cache-provider) read stdout only on success. On failure they log stderr or merge both streams.
LLM Authorship
Test Plan
build:list --non-interactive: the reason (Either log in with eas login ...) is on stderr, next toError: build:list command failed.. On 24.12.1 it was on stdout.tsc,oxlintandoxfmtare clean.🤖 Generated with Claude Code